<!-- 科内-科室自取 -->
<template>
	<ListLayout>
		<Tips :leftText="'派单时间:'+SendRepairInfo.createTime" :rightText="routerParams.text" :color="routerParams.color[routerParams.state]"> </Tips>
		<!--  科室自取信息 -->
		<SelfInfoCard :selfInfo="SelfInfo"></SelfInfoCard>
		<!-- 设备信息-工程师 -->
		<DeviceCard :sendRepairInfo="SendRepairInfo"></DeviceCard>
		<!-- 其他信息-厂家  -->
		<OtherCard :invoiceInfo="InvoiceInfo"></OtherCard>

		<template #footer>
			<ButtonBetween @leftClick="onLeftClick" @rightClick="onRightClick" :rightPlain="false">
				<template #left>
					其他操作
				</template>
				<template #right>
					科室取走
				</template>
			</ButtonBetween>
		</template>
	</ListLayout>
</template>

<script>
	import Tips from '@/components/tips/orderTips.vue'
	import ListLayout from '@/components/layout/listLayout.vue'
	import DeviceCard from '@/components/card/sendRepair/factory/info/device.vue'
	import OtherCard from '@/components/card/sendRepair/factory/info/return-other.vue'

	import SelfInfoCard from '@/components/card/sendRepair/department/info/selfInfoDetail.vue'
	import ButtonBetween from '@/components/buttonGroup/optionButtonGroup.vue'
	import { State } from '@/sendRepair/department/state.js'
	import ReapirApi from '@/apis/repair.js'
	import SendRepairRouterConfig from '@/sendRepair/routerConfig.js'
	export default {
		components: {
			Tips,
			ListLayout,
			DeviceCard,
			OtherCard,
			SelfInfoCard,
			ButtonBetween,
		},

		computed: {
			// 	送修信息
			SendRepairInfo() {
				let {
					repairInfo
				} = this.data
				return repairInfo || {}
			},
			// 其他信息
			InvoiceInfo() {
				let {
					finishRepairResultVo
				} = this.data
				return finishRepairResultVo || {}
			},
			// 自取信息
			SelfInfo() {
				let { deptTakeVo } = this.data
				return deptTakeVo || {}
			}
		},
		data() {
			return {
				data: {},
				routerParams: {
					color: State.colors,
					id: '',
					text: "",
				}
			}
		},
		async onLoad(query) {
			const { state, currStateToName, id } = query
			this.$set(this.routerParams, 'text', currStateToName)
			this.$set(this.routerParams, 'state', Number(state))
			this.$set(this.routerParams, 'id', id)
			let res = await ReapirApi.common.getDetail(id)
			if (res.code === 0) {
				this.data = res.body || {}
			}
		},
		methods: {

			onLeftClick() {

			},

			onRightClick() {
				let { id } = this.routerParams
				wx.navigateTo({
					url: `${SendRepairRouterConfig.Department.ConfirmPickUp}?id=${id}`
				})
			},

		}
	}
</script>

<style lang="scss" scoped>

</style>
